<template>
  <div>
    <!-- 单个商品 -->
    <div class="Pro">
      <!-- 图片位置 -->
      <div class="img" @click="goDetailed(HotProData.pid)">
        <img :src="HotProData.smallImg" alt="" />
        <div class="HotIcon" v-if="HotProData.isHot === 1 ? true : false">
          hot
        </div>
      </div>
      <!-- 商品名称 -->
      <div class="chineseName">{{ HotProData.name }}</div>
      <!-- 商品英文名称 -->
      <div class="EnName">{{ HotProData.enname }}</div>
      <!-- 价格 -->
      <div class="priceBox">
        <div class="price">&yen; {{ HotProData.price }}</div>
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HotPro",
  props: {
    HotProData: {
      HotProData: Object,
      default: [],
    },
  },
  methods: {
    // 跳转到商品详情页
    goDetailed(pid) {
      this.$router.push({ name: "Detailed", query: { pid } });
    },


  },
};
</script>

<style lang="less" scoped>
.Pro {
  width: 100%;
  border-radius: 10px;
  padding: 10px;
  box-sizing: border-box;
  background: #fff;
  .img {
    position: relative;
    img {
      width: 100%;
      border-radius: 10px;
    }
    .HotIcon {
      width: 25px;
      height: 25px;
      background: blue;
      position: absolute;
      top: 0;
      left: 15px;
      text-align: center;
      line-height: 25px;
      color: #fff;
      border-radius: 0px 0px 5px 5px;
    }
  }
  .chineseName {
    font-size: 14px;
    // font-weight: bold;
    color: #888;
  }
  .EnName {
    width: 120px;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 5px;
  }
  .priceBox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    .price {
      color: blue;
      font-weight: bold;
      margin-top: 5px;
    }
  }
}
</style>